

%% Main 
betas =  [0.96, 0.965, 0.970, 0.975, 0.98,0.985,0.99,0.995, 1.0];
gammas =[1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5];
obj = [0,1];
addMinLoad = [0, 1];
housing = [0, 1];
annOn = [1];
unscaled = [0,1];
discreteAnn = [0,1];
fid = fopen('C:\Users\co337\Dropbox\Annuities adapted code\FortranCode\input\finalForRep\inputParamsMain.txt','wt');

allCombs = cartprod(betas,gammas, obj, addMinLoad, housing, annOn, unscaled, discreteAnn);

toDelete = zeros(size(allCombs, 1), 1);
for ix = 1:size(allCombs,1)
%    % Don't need admin load and subjective LE
    if (allCombs(ix, 4) ==1 & allCombs(ix, 3) ==0) 
        toDelete(ix, 1) = ix;
    end 
% Don't need unscaled with admin load on
    if (allCombs(ix, 7) ==1 & allCombs(ix, 4) ==1) 
        toDelete(ix, 1) = ix;
    end 
% Don't need unscaled with housing load on
    if (allCombs(ix, 7) ==1 & allCombs(ix, 5) ==1) 
        toDelete(ix, 1) = ix;
    end 
% Don't need unscaled with discrete annuity on
    if (allCombs(ix, 7) ==1 & allCombs(ix, 8) ==1) 
        toDelete(ix, 1) = ix;
    end    
% Don't need housing with discrete annuity on
    if (allCombs(ix, 5) ==1 & allCombs(ix, 8) ==1) 
        toDelete(ix, 1) = ix;
    end    
% For discrete, only do beta 0.98
    if (allCombs(ix, 8) ==1 & allCombs(ix, 1) ~=0.98)
        toDelete(ix, 1) = ix;
    end    
% For discrete, only do gamma 3
    if (allCombs(ix, 8) ==1 & allCombs(ix, 2) ~=3)
        toDelete(ix, 1) = ix;
    end    
% For housing on, only do beta 0.98
    if (allCombs(ix, 5) ==1 & allCombs(ix, 1) ~=0.98)
        toDelete(ix, 1) = ix;
    end    
% For housing on, only do gamma 3
    if (allCombs(ix, 5) ==1 & allCombs(ix, 2) ~=3)
        toDelete(ix, 1) = ix;
    end        
    
end

toDelete(toDelete==0) = [];
allCombs(toDelete, :) = [];

for ii = 1:size(allCombs,1)
   fprintf(fid,'%g\t',allCombs(ii,:));
   fprintf(fid,'\n');
end
fclose(fid);
